package cj.web.marriage.dao;
/*
 *  
 *  
*/
import java.util.List;
import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.marriage.domain.RefAddress;

/**
 * 
 * @author 
 *
 */
@DAO
public interface RefAddressDAO{
	
	@SQL("SELECT * FROM RefAddress WHERE deleteFlag=1 ORDER BY id ")
    List<RefAddress> queryAll();
	
	@SQL("SELECT * FROM RefAddress WHERE deleteFlag=1 #if(:t.title!=''){ AND name LIKE '%##(:t.name)%' } ORDER BY id LIMIT :t.start,:t.length ")
    List<RefAddress> query(@SQLParam("t") RefAddress refAddress);
	
	@SQL("SELECT count(1) FROM RefAddress WHERE deleteFlag=1 #if(:t.title!=''){ AND name LIKE '%##(:t.name)%' } ORDER BY id ")
    int querysize(@SQLParam("t") RefAddress refAddress);
    
    @SQL("SELECT * FROM RefAddress WHERE id=:1 ")
    RefAddress queryById(int id);
    
    @SQL("INSERT INTO RefAddress (name,address,tel,status,deleteFlag,createAt) VALUES (:t.name,:t.address,:t.tel,1,1,:t.createAt) ")
    void create(@SQLParam("t") RefAddress refAddress);
	
	@SQL("UPDATE RefAddress SET authoDescs=:2 WHERE id=:1 ")
    void update(int id,String authoDescs);
    
    @SQL("UPDATE RefAddress SET deleteFlag=0 WHERE id=:1 ")
    void deleteById(int id);
}